package com.xuwang.controller;

import com.xuwang.service.impl.DownloadExcelTemplateServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author: YuePeng
 * @Date: 2021/9/16 16:14
 * @Version: 1.0
 */
@Controller
@RequestMapping("/downloadExcelTemplate")
@Api(value = "Excel文件导出管理", tags = "Excel文件导出管理接口API")
@ApiResponses({
        @ApiResponse(code = 400, message = "请求参数不完整或者错误"),
        @ApiResponse(code = 404, message = "找不到页面"),
        @ApiResponse(code = 405, message = "请求方式不正确，比如后台接收是post，但前端请求的是get"),
        @ApiResponse(code = 406, message = "页面地址和接口名冲突"),
        @ApiResponse(code = 415, message = "请求格式不正确，前端可能没有把请求头修改为json，也可能前端请求的json对象没有转换为字符串"),
        @ApiResponse(code = 500, message = "后台服务逻辑错误")
})
public class DownloadExcelTemplateController {

    @Resource
    private DownloadExcelTemplateServiceImpl downloadExcelTemplateService;
    @PostMapping("/governmentStaff")
    @ApiOperation(value = "政府人员信息模板导入接口", notes = "政府人员信息模板导入接口")
    @GetMapping("/governmentStaff")
    public void downloadGovernmentExcelTemplate(HttpServletRequest request,HttpServletResponse response) throws IOException {
        downloadExcelTemplateService.downloadGovernmentExcelTemplate(request, response);
    }
}
